<template>
  <div class="app-container">
    <el-form
      ref="listFilterRef"
      :model="list.filter"
      inline
      class="list-filter"
    >
      <el-form-item prop="name">
        <el-input v-model="list.filter.name" placeholder="名称">
          <i slot="prefix" class="el-input__icon el-icon-search" />
        </el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="reset">
          重置
        </el-button>
      </el-form-item>
    </el-form>

    <div class="table-operation">
      <AuthButton @click="c" name="新增" />
      <el-pagination
        v-bind="elPaginationProps"
        :total="list.total"
        :currentPage.sync="list.filter.pageNo"
        :pageSize.sync="list.filter.pageSize"
      />
    </div>

    <el-table v-loading="list.loading" :data="list.data" v-bind="tableProp">
      <el-table-column label="名称" prop="name" />
      <el-table-column label="路径" prop="path" />
      <el-table-column label="创建时间" prop="createTime" />
      <el-table-column label="备注" prop="remark" />
      <!--<el-table-column label="状态">
        <template slot-scope="scope">
          <el-tag :type="options__.status.type[scope.row.status]">{{options__.status.default[scope.row.status]}}</el-tag>
        </template>
      </el-table-column>-->
      <el-table-column label="操作" class-name="small-padding">
        <template slot-scope="{ row }">
          <auth-button @click="u({ id: row.id })" name="编辑" />
          <auth-button @click="d({ id: row.id })" name="删除" />
        </template>
      </el-table-column>
    </el-table>

    <KiFormDialog
      :show.sync="form.show"
      :title="formTitle"
      v-model="form.data"
      :submit="submitForm"
      :readonly="form.status === 'r'"
      ref="formRef"
      :loading="form.loading"
    >
      <template #el-form>
        <el-form-item label="名称" prop="name" verify>
          <el-input v-model="form.data.name" placeholder="请输入名称" />
        </el-form-item>
        <el-form-item label="路径" prop="path" verify>
          <el-input
            v-model="form.data.path"
            placeholder="请输入小程序跳转路径"
          />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input
            type="textarea"
            v-model="form.data.remark"
            placeholder="请输入备注"
            maxlength="100"
            show-word-limit
          />
        </el-form-item>
      </template>
    </KiFormDialog>
  </div>
</template>

<script>
import pageMixin from '@/utils/pageMixin'
import useAdmateAdapter from '@/utils/useAdmateAdapter'

export default {
  mixins: [pageMixin],
  components: {},
  setup: () =>
    useAdmateAdapter({
      urlPrefix: 'one-travel-api/appletpath'
    })
}
</script>

<style lang="scss" scoped></style>
